package com.zzccyy.jpdemo.page

import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.zzccyy.jpdemo.R
import com.zzccyy.jpdemo.base.BasicBaseActivity
import com.zzccyy.jpdemo.bean.AaaBean1
import com.zzccyy.jpdemo.utils.AaaAdapter1

class AaaActivity : BasicBaseActivity(), View.OnClickListener {
    private var ivClose: ImageView? = null
    private var tttN: TextView? = null
    private var recyclerView: RecyclerView? = null


    override val layoutId: Int
        get() = R.layout.activity_aa

    override fun findViews() {
        ivClose = findViewById(R.id.ivClose)
        tttN = findViewById(R.id.tttN)
        recyclerView = findViewById(R.id.recyclerView)
    }

    override fun setListener() {
        ivClose!!.setOnClickListener(this)
    }


    override fun onClick(v: View) {
        super.onClick(v)
        when (v.id) {
            R.id.ivClose -> finish()
        }
    }


    override fun initData() {
        val intent = intent
        val stringExtra = intent.getStringExtra("nn")
        val list = intent.getSerializableExtra("data") as List<AaaBean1.DataBean>?
        tttN!!.text = stringExtra

        val linearLayoutManager = LinearLayoutManager(this)
        linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
        recyclerView!!.layoutManager = linearLayoutManager
        val aaaAdapter1 = AaaAdapter1(this@AaaActivity, R.layout.item_aaa, list)
        recyclerView!!.adapter = aaaAdapter1
    }
}